package com.byedu.course;

import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.Random;
import java.util.Set;

/**
 * Created by Luo on 2017-10-13.
 */
public class JedisSoredRankSet {

    public static void main(String[] args) throws InterruptedException {
        Jedis jedis = new Jedis("123.57.157.106",6379);
        String[] heros = new String[]{"秦王","刘备","赵云","张飞","关羽","曹操","张露","孙权","孔明","周瑜"};
        Random random = new Random();

        while(true){
            int nextInt = random.nextInt(10);
            String hero = heros[nextInt];
            Thread.sleep(1000+random.nextInt(1)*1000);
            jedis.zincrby("chuchang:bang",1.00,hero);

            System.out.println("本次出场英雄："+hero);
        }
    }
}
